﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
namespace DemoGame1
{
    public class Map : VisibleGameEntity
    {

        private float _Scale = 1.0f;

        public float Scale
        {
            get { return _Scale; }
            set { _Scale = value;
                for (int i = 0; i < nSprites; i++)
                    Sprites[i].Scale = value;
            }
        }


        public Map(ContentManager content, string strTexture, Vector2 _topleft, Vector2 _size)
        {
            //InitMyButton(content, strTexture, nTextures,  _topleft,  _size);
            TopLeft = _topleft;
            Size = _size;
            //  TrueSize = _size;
            Texture2D[] textures = new Texture2D[1];
            Sprites = new List<My2DSprite>();
            textures[0] = content.Load<Texture2D>(strTexture);



            My2DSprite tempsprite = new My2DSprite(textures, TopLeft);
            tempsprite.Size = _size;
            tempsprite.TrueSize = _size;
            Sprites.Add(tempsprite);
            nSprites = 1;
        }

        public override void Draw(SpriteBatch sb, GameTime gameTime)
        {
            if (Size.X != 0)
            {
                Sprites[0].Position = -_TopLeft * _Scale;
                Vector2 temp = Sprites[0].TrueSize;
                temp.X *= _Scale;
                temp.Y *= _Scale;
                Sprites[0].Size = temp;
            }
            base.Draw(sb, gameTime);
        }

    }
}
   